(if (> @user-level 0)   ; print a little welcome
    (message "This utility installs Action on your harddisk.\n"
             "Since you are an advanced user, you will "
             "be asked a place to copy the Action Program to.\n\n"
             "WhatIs.library will be installes in LIBS:\n"
             "The sample FileTypes file for WhatIs.library will"
             " be installed in your S: directory\n"
             "The sample Action definitions will be installed in your"
             " ENVARC: and ENV: directory\n")
)

(set @default-dest
    (askdir (prompt "Select a directory to copy Action to")
            (help @askdir-help)
            (default "SYS:Utilities/")
            (newpath)
    )
)

(protect "Action" "+p")

(copyfiles
    (source "Action")
    (dest   @default-dest)
    (infos)
)

(copylib
    (source "Libs/WhatIs.library")
    (dest "LIBS:")
)

(if (exists "ENVARC:Action")
    (	(if (NOT (exists "ENVARC:Action/Action.View"))
	    (	(copyfiles
		    (source "ENV/Action/Action.View")
		    (dest "ENVARC:Action")
		)
	    	(copyfiles
		    (source "ENV/Action/Action.View")
		    (dest "ENV:Action")
		)
	    )
	)
    	(if (NOT (exists "ENVARC:Action/Action.View"))
	    (	(copyfiles
		    (source "ENV/Action/Action.View")
		    (dest "ENVARC:Action")
		)
	    	(copyfiles
		    (source "ENV/Action/Action.View")
		    (dest "ENV:Action")
		)
	    )
	)
    )
    (	(copyfiles
	    (all)
            (source "ENV/Action")
	    (dest "ENV:Action")
	)
	(copyfiles
	    (all)
            (source "ENV/Action")
	    (dest "ENVARC:Action")
	)
    )
)

(if (NOT (exists "S:FileTypes"))
    (copyfiles
        (source "S/FileTypes")
        (dest   "S:")
    )
)
